Shadow map code
Code
Here is some starter code:
- shadowMap.vert:
//TODO: move vertex, put in light view
vec4 vertPos = mR * mT * vec4(pos, 1);
vertPos = Lp * Lv * vertPos;
return vertPos;
- reflectance.vert:
//TODO: move vertex, put in light view
vec4 vertPos = mR * mT * vec4(pos, 1);
vertPos = offset * Lp * Lv * vertPos;
return vertPos;
- reflectance.frag:
//TODO: adjust for the perspective divide and bias
vec4 shp = shadowPos;
shp = shp/shp.w;
shp.z = shp.z - getBias();
return shp;
- reflectance.frag:
//TODO lookup the distance in the shapow map, get surface and occlusion distance
vec4 shadowTexel = texture(texId, shadowPoint.xy);
float surfaceDistance = shadowPoint.z;
float occlusionDistance = shadowTexel.z;